home *** CD-ROM | disk | FTP | other *** search
/ ftp.mactech.com 2010 / ftp.mactech.com.tar / ftp.mactech.com / machack / Hacks97 / WarriorsProgress.sit / Warrior’s Progress / source code / Source / Libraries / Method / TextMethodOf.h < prev    next >
Text File  |  1997-06-28  |  573b  |  36 lines

  1. // TextMethodOf.h
  2.  
  3. #ifndef TextMethodOf_h
  4. #define TextMethodOf_h
  5.  
  6. #ifndef TextMethod_h
  7. #include "TextMethod.h"
  8. #endif
  9.  
  10. template <class TargetType>
  11. class TextMethodOf: public TextMethod
  12.   {
  13.     typedef TargetType Target;
  14.     typedef void (Target::*Method)( ConstData );
  15.     
  16.     private:
  17.         Target& target;
  18.         Method method;
  19.     
  20.     public:
  21.         TextMethodOf( Target& theTarget,
  22.                           Method theMethod )
  23.           : target( theTarget ),
  24.              method( theMethod )
  25.           {
  26.             Assert( method != 0 );
  27.           }
  28.         
  29.         virtual void operator()( ConstData text )
  30.           {
  31.             (target.*method)( text );
  32.           }
  33.   };
  34.  
  35. #endif
  36.